import messages from './lang/index'

import Vue from 'vue'
import VueI18n from 'vue-i18n'
// import ElementUI from 'element-ui'
// import { zh, en, ja } from './element-ui-lang'

// let en: any = require('element-ui/lib/locale/lang/en');

// 合并element-ui语言包
for (let i in messages) {
  if (i) {
    let element: any = null
    switch (i) {
      // case 'zh': element = zh; break
      // case 'en': element = en; break
      // case 'jp': element = ja; break
    }
    messages[i] = {
      ...messages[i],
      ...element
    }
  }
}

// 引入国际化
Vue.use(VueI18n)

// Vue.use(ElementUI, {
//   i18n: (key: any, value: any) => i18n.t(key, value)
// })

const i18n = new VueI18n({
  locale: 'zh', // 默认语种
  messages
})

export default i18n
